
<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title><?php echo $title;?></title>
    <!-- 设置缩放 -->
    <meta name="viewport" content="minimal-ui,width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" />
    <!-- IOS中禁用将数字识别为电话号码/忽略Android平台中对邮箱地址的识别 -->
    <meta name="format-detection" content="telephone=no" />
    <!-- windows phone 点击无高光 -->
    <meta name="msapplication-tap-highlight" content="no" />
    <!-- icon -->
    <link rel="shortcut icon" href="<?php echo ADMIN_ICO_PIC;?>" type="image/x-icon"/>
    <!-- css -->
    <link rel="stylesheet" type="text/css" href="<?php echo SYS_LINK;?>admin/css/content.css?v=<?php echo V_CSSJS;?>" />
    <style>

    </style>
</head>
<body>
<div class="con_box">
    <div class="titleH18">添加<?php echo isset($menuInfo['menuname']) ? $menuInfo['menuname'] : '';?>内容</div>
    <form class="form_box" id="imgViewerBox">
        <input type="hidden" name="mould_code" value="<?php echo $mouldCode;?>">
        <input type="hidden" name="menu_id" value="<?php echo $menu_id;?>">
        <input type="hidden" name="fid" value="<?php echo $fid;?>">
        <div class="form_item">
            <label>内容标题</label>
            <input type="text" name="title" autocomplete="off" placeholder="请输入">
            <i class="hint">* (必填)内容标题</i>
        </div>
        <?php echo $fieldItemHtml;?>
        <div class="form_item">
            <label>创建时间</label>
            <input type="text" name="createdate" autocomplete="off" id="createdate" placeholder="请输入">
            <i class="hint">* (必填)默认当前时间</i>
        </div>
        <div class="form_item">
            <label>展示排序</label>
            <input type="number" name="viewseq" value="0" autocomplete="off" placeholder="显示排序顺序" class="input100">
            <i class="hint">* (必填)必须正整数，显示排序顺序，越大越靠前，默认0</i>
        </div>
        <div class="form_item">
            <label>添加次数</label>
            <input type="number" name="foreachno" value="0" autocomplete="off" placeholder="开发者测试用" class="input100">
            <i class="hint">*  * 一次循环添加多条（开发者测试用）</i>
        </div>
        <div class="form_item">
            <label>内容状态</label>
            <label class="radio"><input type="radio" value="1" name="status" checked="checked">已审</label>
            <label class="radio"><input type="radio" value="2" name="status">停用</label>
            <label class="radio"><input type="radio" value="3" name="status">待审</label>
            <i class="hint">* (必选)状态</i>
        </div>

        <div class="form_item">
            <label style="color:#ff7f77"> 编辑需保存 </label>
            <input type="button" id="sub_btn" value="提交保存" class="btn_base btn_back_sides btn_w300 btn_height35 btn_radius5">
        </div>
    </form>
</div>
</body>
<script language="javascript">
    var cssjsv = '<?php echo V_CSSJS;?>';
    var http_url = '<?php echo SYS_HOST;?>';
    var http_link = '<?php echo SYS_LINK;?>';
    var http_fix = '<?php echo SYS_URL_FIX;?>';
</script>
<script type="text/javascript" src="<?php echo SYS_LINK;?>admin/js/jquery.min.js?v=<?php echo V_CSSJS;?>"></script>
<script type="text/javascript" src="<?php echo SYS_LINK;?>admin/js/skin.js?v=<?php echo V_CSSJS;?>"></script>
<script type="text/javascript" src="<?php echo SYS_LINK;?>admin/js/common.js?v=<?php echo V_CSSJS;?>"></script>
<script type="text/javascript">file_load('info');</script>
<script language="javascript">

    var nowDate = '<?php echo date("Y-m-d");?>';
    var gotoUrl = '<?php echo SYS_URL_PATH("admin_essay_add/c/$menu_id");?>';

    // 页面加载完毕
    window.onload = function () {

        <?php echo $fieldItemStyle;?>

        // 图片预览
        var viewer = new Viewer(document.getElementById('imgViewerBox'), {
            url: 'img_src'
        });

        // 颜色选择器
        $('.jscolors').jPicker();

        // 日期
        jeDate({
            dateCell: '#createdate',
            isTime: true,
            format: 'YYYY-MM-DD hh:mm:ss',
            minDate: '2022-06-01',
            maxDate:nowDate
        })

    }

    var flagSub = true;
    // 数据提交
    $(function(){
        $('#sub_btn').on('click',function(){
            if(!flagSub){
                layer.msg('处理中……(禁止重复提交)');return false;
            }
            flagSub = false;
            var fromBox = $('.form_box');
            var param = getFormData(fromBox);
            param.append('subFlag', 'Y'); // 追加参数
            $.ajax({
                url:gotoUrl,
                dataType:'json',
                type:'POST',
                async: false,
                data: param,
                processData : false, // 使数据不做处理
                contentType : false, // 不要设置Content-Type请求头
                success: function(data){
                    flagSub = true;
                    if(data=='Y'){
                        layer.msg('添加成功');
                        setTimeout(function(){
                            parent.location.reload();
                        },2500);
                    }else{
                        layer.msg('操作失败_'+data);
                    }
                },
                error:function(response){
                    flagSub = true;
                    layer.msg('网络异常');
                    console.log('网络异常：'+response);
                }
            });
        })
    })
</script>
</html>